<?php
declare(strict_types=1);
namespace App\Controller\Api;

use Hyperf\HttpServer\Contract\RequestInterface;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\RequestMapping;
use App\Controller\AbstractController;
use App\Service\CommonDataService\ExpressSupplierDataService;

/**
 * @Controller(prefix="/ExpressSupplier")
 * 服务配置查询中心
 */
class ExpressSupplierController extends AbstractController
{
    /**
     * 获取三方物流配置信息列表
     * @RequestMapping(path="queryExpressSupplierList", methods="POST")
     * @return string[]
     */
    public function queryExpressSupplierList(RequestInterface $request,ExpressSupplierDataService $ExpressSupplierDataService)
    {
        return $ExpressSupplierDataService->queryExpressSupplierList(
            (string)$request->input('userType'),
            (int)$request->input('limit'),
            (int)$request->input('page')
            );
    }
    /**
     * 获取基础物流信息
     * @RequestMapping(path="queryExpressList", methods="POST")
     * @return string[]
     */
    public function queryExpressList(RequestInterface $request,ExpressSupplierDataService $ExpressSupplierDataService)
    {
        return $ExpressSupplierDataService->queryExpressList();
    }
    
    /**
     * 新增三方物流信息
     * @RequestMapping(path="addExpressSupplier", methods="POST")
     * @return string[]
     */
    public function addExpressSupplier(RequestInterface $request,ExpressSupplierDataService $ExpressSupplierDataService)
    {
        return $ExpressSupplierDataService->addExpressSupplier(
            (string)$request->input('userType'),
            (string)$request->input('expressSupplierName'),
            (string)$request->input('expressName'),
            (string)$request->input('expressCode')
            );
    }

    /**
     * 修改三方物流信息
     * @RequestMapping(path="updateExpressSupplier", methods="POST")
     * @return string[]
     */
    public function updateExpressSupplier(RequestInterface $request,ExpressSupplierDataService $ExpressSupplierDataService)
    {
        return $ExpressSupplierDataService->updateExpressSupplier(
            (int)$request->input('ID'),
            (string)$request->input('userType'),
            (string)$request->input('expressSupplierName'),
            (string)$request->input('expressName'),
            (string)$request->input('expressCode')
            );
    }

    /**
     * 查询但单个供应的三方物流信息
     * @RequestMapping(path="querySupplierExpress", methods="POST")
     * @return string[]
     */
    public function querySupplierExpress(RequestInterface $request,ExpressSupplierDataService $ExpressSupplierDataService)
    {
        return $ExpressSupplierDataService->querySupplierExpress(
            (string)$request->input('userType'),
            (array)$request->input('expressSupplierName')
            );
    }
}